<template>
  <div>
    <el-row>
      <el-col :span="24">
        <div class="grid-content bg-purple-light">
          <h3>产品审批信息</h3>
          <template>
            <el-table :data="productRecordList" stripe style="width: 100%">
              <el-table-column prop="productName" label="产品名称" width="100">
              </el-table-column>
              <el-table-column prop="productDesc" label="产品简介" width="120">
              </el-table-column>
              <el-table-column
                prop="productPicture"
                label="注册资金（元）"
                width="100"
              >
              </el-table-column>
              <el-table-column
                prop="productTypeId"
                label="产品类型"
                width="100"
              >
              </el-table-column>
              <el-table-column
                prop="producPayMethod"
                label="还款方式"
                width="100"
              >
              </el-table-column>
              <el-table-column prop="productFlag" label="产品状态" width="100">
              </el-table-column>
              <el-table-column prop="productrecordPerson" label="审批人" width="100">
              </el-table-column>
              <el-table-column prop="productrecordResult" label="审批结果" width="80">
              </el-table-column>
              <el-table-column prop="productrecordApproveDate" label="审批时间" width="100">
              </el-table-column>
              <el-table-column prop="productrecordLead" label="审批意见" width="120">
              </el-table-column>
              <el-table-column prop="address" label="操作" width="200">
                <template slot-scope="scope">
                <el-button type="warning" @click="del(scope.row.productrecordId)">删除</el-button>
                </template>
              </el-table-column>
            </el-table>
          </template></div></el-col
    ></el-row>
  </div>
</template>

<script>
export default {
  data() {
    return {
      productRecordList:[]
    };
  },
  methods: {
    selectAllRecord(){
      this.$axios.get("/productRecords")
      .then(res=>{
        this.productRecordList = res.data.data.productRecords;
      })
    },
    del(id){
      this.$axios.delete("/productRecords/"+id)
      .then(res=>{
        if(res.data.code == 200){
          this.$message.success("删除成功");
          this.selectAllRecord();
        }else{
          this.$message.error("删除失败，请稍后再试");
        }
      })
    }
  },
  mounted(){
    this.selectAllRecord();
  }
};
</script>